home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / AIncludes / CursorDevices.a < prev    next >
Encoding:
Text File  |  1996-05-29  |  8.4 KB  |  321 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        CursorDevices.a
  3. ;
  4. ;    Contains:    Cursor Devices (mouse/trackball/etc) Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Package:    Universal Interfaces 2.2 in “MPW” on ETO #20
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__CURSORDEVICES__') = 'UNDEFINED' THEN
  21. __CURSORDEVICES__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  25.     include 'Types.a'
  26.     ENDIF
  27. ;        include 'ConditionalMacros.a'                                ;
  28.  
  29.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  30.     include 'MixedMode.a'
  31.     ENDIF
  32. ;
  33. ;                       * * *  W A R N I N G  * * * 
  34. ;
  35. ;    On currently shipping PowerMacs, the CursorDevices manager is implemented
  36. ;    in 68K code and emulated.  Unfortunately, the MixedMode glue in InterfaceLib
  37. ;    is incorrect.  It and the 1.0 version of this file had incorrect parameter
  38. ;    lists for most functions.
  39. ;    
  40. ;    As a first step to avoid runtime errors, the functions in this file were 
  41. ;    renamed (e.g. from"CrsrDevButtons" to "CursorDeviceButtons").  This will result
  42. ;    in a link time error if a PowerPC application tries to call the functions.
  43. ;    When InterfaceLib is fixed, the new names will be exported and PowerPC
  44. ;    code will then be able to call them.
  45. ;    
  46. ;
  47. ; typedef short             ButtonOpcode
  48. ; ButtonOpcodes 
  49.  
  50. kButtonNoOp                        EQU        0                    ; No action for this button 
  51. kButtonSingleClick                EQU        1                    ; Normal mouse button 
  52. kButtonDoubleClick                EQU        2                    ; Click-release-click when pressed 
  53. kButtonClickLock                EQU        3                    ; Click on press, release on next press 
  54. kButtonCustom                    EQU        6                    ; Custom behavior, data = CursorDeviceCustomButtonUPP 
  55.  
  56. ; Device Classes 
  57. kDeviceClassAbsolute            EQU        0                    ; a flat-response device 
  58. kDeviceClassMouse                EQU        1                    ; mechanical or optical mouse 
  59. kDeviceClassTrackball            EQU        2                    ; trackball 
  60. kDeviceClassTrackPad            EQU        3
  61. kDeviceClass3D                    EQU        6                    ; a 3D pointing device 
  62.  
  63. ; Structures used in Cursor Device Manager calls 
  64. CursorData                 RECORD    0
  65. nextCursorData             ds.l   1        ; offset: $0 (0)        ; next in global list 
  66. displayInfo                 ds.l   1        ; offset: $4 (4)        ; unused (reserved for future) 
  67. whereX                     ds.l   1        ; offset: $8 (8)        ; horizontal position 
  68. whereY                     ds.l   1        ; offset: $C (12)        ; vertical position 
  69. where                     ds     Point    ; offset: $10 (16)        ; the pixel position 
  70. isAbs                     ds.b   1        ; offset: $14 (20)        ; has been stuffed with absolute coords 
  71. buttonCount                 ds.b   1        ; offset: $15 (21)        ; number of buttons currently pressed 
  72. screenRes                 ds.w   1        ; offset: $16 (22)        ; pixels per inch on the current display 
  73. privateFields             ds.w   22        ; offset: $18 (24)        ; fields use internally by CDM 
  74. sizeof                     EQU *            ; size:   $44 (68)
  75.                         ENDR
  76.  
  77. ; typedef struct CursorData  CursorData, *CursorDataPtr
  78. CursorDevice             RECORD    0
  79. nextCursorDevice         ds.l   1        ; offset: $0 (0)        ; pointer to next record in linked list 
  80. whichCursor                 ds.l   1        ; offset: $4 (4)        ; pointer to data for target cursor 
  81. refCon                     ds.l   1        ; offset: $8 (8)        ; application-defined 
  82. unused                     ds.l   1        ; offset: $C (12)        ; reserved for future 
  83. devID                     ds.l   1        ; offset: $10 (16)        ; device identifier (from ADB reg 1) 
  84. resolution                 ds.l   1        ; offset: $14 (20)        ; units/inch (orig. from ADB reg 1) 
  85. devClass                 ds.b   1        ; offset: $18 (24)        ; device class (from ADB reg 1) 
  86. cntButtons                 ds.b   1        ; offset: $19 (25)        ; number of buttons (from ADB reg 1) 
  87. filler1                     ds.b   1        ; offset: $1A (26)        ; reserved for future 
  88. buttons                     ds.b   1        ; offset: $1B (27)        ; state of all buttons 
  89. buttonOp                 ds.b   8        ; offset: $1C (28)        ; action performed per button 
  90. buttonTicks                 ds.l   8        ; offset: $24 (36)        ; ticks when button last went up (for debounce) 
  91. buttonData                 ds.l   8        ; offset: $44 (68)        ; data for the button operation 
  92. doubleClickTime             ds.l   1        ; offset: $64 (100)        ; device-specific double click speed 
  93. acceleration             ds.l   1        ; offset: $68 (104)        ; current acceleration 
  94. privateFields             ds.w   15        ; offset: $6C (108)        ; fields used internally to CDM 
  95. sizeof                     EQU *            ; size:   $8A (138)
  96.                         ENDR
  97.  
  98. ; typedef struct CursorDevice  CursorDevice, *CursorDevicePtr
  99. ; for use with CursorDeviceButtonOp when opcode = kButtonCustom 
  100. ;
  101. ; pascal OSErr CursorDeviceMove(CursorDevicePtr ourDevice, long deltaX, long deltaY)
  102. ;
  103.     IF ¬ GENERATINGCFM THEN
  104.         Macro
  105.         _CursorDeviceMove
  106.             moveq    #0,d0
  107.             dc.w     $AADB
  108.         EndM
  109.     ELSE
  110.         IMPORT_CFM_FUNCTION    CursorDeviceMove
  111.     ENDIF
  112.  
  113. ;
  114. ; pascal OSErr CursorDeviceMoveTo(CursorDevicePtr ourDevice, long absX, long absY)
  115. ;
  116.     IF ¬ GENERATINGCFM THEN
  117.         Macro
  118.         _CursorDeviceMoveTo
  119.             moveq    #1,d0
  120.             dc.w     $AADB
  121.         EndM
  122.     ELSE
  123.         IMPORT_CFM_FUNCTION    CursorDeviceMoveTo
  124.     ENDIF
  125.  
  126. ;
  127. ; pascal OSErr CursorDeviceFlush(CursorDevicePtr ourDevice)
  128. ;
  129.     IF ¬ GENERATINGCFM THEN
  130.         Macro
  131.         _CursorDeviceFlush
  132.             moveq    #2,d0
  133.             dc.w     $AADB
  134.         EndM
  135.     ELSE
  136.         IMPORT_CFM_FUNCTION    CursorDeviceFlush
  137.     ENDIF
  138.  
  139. ;
  140. ; pascal OSErr CursorDeviceButtons(CursorDevicePtr ourDevice, short buttons)
  141. ;
  142.     IF ¬ GENERATINGCFM THEN
  143.         Macro
  144.         _CursorDeviceButtons
  145.             moveq    #3,d0
  146.             dc.w     $AADB
  147.         EndM
  148.     ELSE
  149.         IMPORT_CFM_FUNCTION    CursorDeviceButtons
  150.     ENDIF
  151.  
  152. ;
  153. ; pascal OSErr CursorDeviceButtonDown(CursorDevicePtr ourDevice)
  154. ;
  155.     IF ¬ GENERATINGCFM THEN
  156.         Macro
  157.         _CursorDeviceButtonDown
  158.             moveq    #4,d0
  159.             dc.w     $AADB
  160.         EndM
  161.     ELSE
  162.         IMPORT_CFM_FUNCTION    CursorDeviceButtonDown
  163.     ENDIF
  164.  
  165. ;
  166. ; pascal OSErr CursorDeviceButtonUp(CursorDevicePtr ourDevice)
  167. ;
  168.     IF ¬ GENERATINGCFM THEN
  169.         Macro
  170.         _CursorDeviceButtonUp
  171.             moveq    #5,d0
  172.             dc.w     $AADB
  173.         EndM
  174.     ELSE
  175.         IMPORT_CFM_FUNCTION    CursorDeviceButtonUp
  176.     ENDIF
  177.  
  178. ;
  179. ; pascal OSErr CursorDeviceButtonOp(CursorDevicePtr ourDevice, short buttonNumber, ButtonOpcode opcode, long data)
  180. ;
  181.     IF ¬ GENERATINGCFM THEN
  182.         Macro
  183.         _CursorDeviceButtonOp
  184.             moveq    #6,d0
  185.             dc.w     $AADB
  186.         EndM
  187.     ELSE
  188.         IMPORT_CFM_FUNCTION    CursorDeviceButtonOp
  189.     ENDIF
  190.  
  191. ;
  192. ; pascal OSErr CursorDeviceSetButtons(CursorDevicePtr ourDevice, short numberOfButtons)
  193. ;
  194.     IF ¬ GENERATINGCFM THEN
  195.         Macro
  196.         _CursorDeviceSetButtons
  197.             moveq    #7,d0
  198.             dc.w     $AADB
  199.         EndM
  200.     ELSE
  201.         IMPORT_CFM_FUNCTION    CursorDeviceSetButtons
  202.     ENDIF
  203.  
  204. ;
  205. ; pascal OSErr CursorDeviceSetAcceleration(CursorDevicePtr ourDevice, Fixed acceleration)
  206. ;
  207.     IF ¬ GENERATINGCFM THEN
  208.         Macro
  209.         _CursorDeviceSetAcceleration
  210.             moveq    #8,d0
  211.             dc.w     $AADB
  212.         EndM
  213.     ELSE
  214.         IMPORT_CFM_FUNCTION    CursorDeviceSetAcceleration
  215.     ENDIF
  216.  
  217. ;
  218. ; pascal OSErr CursorDeviceDoubleTime(CursorDevicePtr ourDevice, long durationTicks)
  219. ;
  220.     IF ¬ GENERATINGCFM THEN
  221.         Macro
  222.         _CursorDeviceDoubleTime
  223.             moveq    #9,d0
  224.             dc.w     $AADB
  225.         EndM
  226.     ELSE
  227.         IMPORT_CFM_FUNCTION    CursorDeviceDoubleTime
  228.     ENDIF
  229.  
  230. ;
  231. ; pascal OSErr CursorDeviceUnitsPerInch(CursorDevicePtr ourDevice, Fixed resolution)
  232. ;
  233.     IF ¬ GENERATINGCFM THEN
  234.         Macro
  235.         _CursorDeviceUnitsPerInch
  236.             moveq    #10,d0
  237.             dc.w     $AADB
  238.         EndM
  239.     ELSE
  240.         IMPORT_CFM_FUNCTION    CursorDeviceUnitsPerInch
  241.     ENDIF
  242.  
  243. ;
  244. ; pascal OSErr CursorDeviceNextDevice(CursorDevicePtr *ourDevice)
  245. ;
  246.     IF ¬ GENERATINGCFM THEN
  247.         Macro
  248.         _CursorDeviceNextDevice
  249.             moveq    #11,d0
  250.             dc.w     $AADB
  251.         EndM
  252.     ELSE
  253.         IMPORT_CFM_FUNCTION    CursorDeviceNextDevice
  254.     ENDIF
  255.  
  256. ;
  257. ; pascal OSErr CursorDeviceNewDevice(CursorDevicePtr *ourDevice)
  258. ;
  259.     IF ¬ GENERATINGCFM THEN
  260.         Macro
  261.         _CursorDeviceNewDevice
  262.             moveq    #12,d0
  263.             dc.w     $AADB
  264.         EndM
  265.     ELSE
  266.         IMPORT_CFM_FUNCTION    CursorDeviceNewDevice
  267.     ENDIF
  268.  
  269. ;
  270. ; pascal OSErr CursorDeviceDisposeDevice(CursorDevicePtr ourDevice)
  271. ;
  272.     IF ¬ GENERATINGCFM THEN
  273.         Macro
  274.         _CursorDeviceDisposeDevice
  275.             moveq    #13,d0
  276.             dc.w     $AADB
  277.         EndM
  278.     ELSE
  279.         IMPORT_CFM_FUNCTION    CursorDeviceDisposeDevice
  280.     ENDIF
  281.  
  282.  
  283. ;
  284. ;                       * * *  W A R N I N G  * * * 
  285. ;                
  286. ;    Even though the glue in InterfaceLib on PowerMacs for CursorDevices
  287. ;    is generally wrong, the two popular routines CrsrDevNextDevice
  288. ;    and CrsrDevMoveTo actually work.  Because we still don't have a 
  289. ;    fixed library, we are adding back prototypes (with the old name)
  290. ;    so that these functions can be called.
  291. ;
  292. ;
  293. ;
  294. ;
  295. ; pascal OSErr CrsrDevMoveTo(CursorDevicePtr ourDevice, long absX, long absY)
  296. ;
  297.     IF ¬ GENERATINGCFM THEN
  298.         Macro
  299.         _CrsrDevMoveTo
  300.             moveq               #1,D0
  301.             dc.w                $AADB
  302.         EndM
  303.     ELSE
  304.         IMPORT_CFM_FUNCTION CrsrDevMoveTo
  305.     ENDIF
  306.  
  307. ;
  308. ; pascal OSErr CrsrDevNextDevice(CursorDevicePtr *ourDevice)
  309. ;
  310.     IF ¬ GENERATINGCFM THEN
  311.         Macro
  312.         _CrsrDevNextDevice
  313.             moveq               #11,D0
  314.             dc.w                $AADB
  315.         EndM
  316.     ELSE
  317.         IMPORT_CFM_FUNCTION CrsrDevNextDevice
  318.     ENDIF
  319.  
  320.     ENDIF ; __CURSORDEVICES__ 
  321.